#ifndef PRODUCERTHREAD_H
#define PRODUCERTHREAD_H

#include <QThread>
#include <QMutex>
#include <QRandomGenerator>

class ProducerThread : public QThread
{
    Q_OBJECT
public:
    explicit ProducerThread(QObject *parent = nullptr);
    void stop();

signals:
    void dataProduced(int value);  // 数据生产信号

protected:
    void run() override;

private:
    bool m_stopped;
    QMutex m_mutex;
};

#endif // PRODUCERTHREAD_H
